﻿using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;

namespace Savage.DotNetLibrary.TestDotNetLibrary.ImageLibraryTests
{
    [TestFixture]
    public class TestExifRational
    {
        [Test]
        public void TestDenominator()
        {
            ImageLibrary.ExifRational rational = new Savage.DotNetLibrary.ImageLibrary.ExifRational(12, 46);
            Assert.AreEqual(46, rational.Denominator);

            rational.Denominator = 12;
            Assert.AreEqual(12, rational.Denominator);
        }

        [Test]
        public void TestNumerator()
        {
            ImageLibrary.ExifRational rational = new Savage.DotNetLibrary.ImageLibrary.ExifRational(18, 19);
            Assert.AreEqual(18, rational.Numerator);

            rational.Numerator = 4;
            Assert.AreEqual(4, rational.Numerator);
        }

        [Test]
        public void TestToDecimal()
        {
            ImageLibrary.ExifRational rational = new Savage.DotNetLibrary.ImageLibrary.ExifRational(15, 20);
            Assert.AreEqual(0.75m, rational.ToDecimal());
        }

        [Test]
        public void TestToString()
        {
            ImageLibrary.ExifRational rational = new Savage.DotNetLibrary.ImageLibrary.ExifRational(14, 15);
            Assert.AreEqual("14/15", rational.ToString());
        }
    }
}
